#pragma once
#include <cstdint>
#include <vector>
#include <array>
#include <utility>
#include "./utils/random_pair_list.hpp"
#include "./utils/random_array.hpp"


namespace clay {
    template<std::uint8_t rotors_number>
    struct EnigmaKey {
        std::array<std::uint8_t, rotors_number> rotor_shifts;
        std::vector<std::pair<std::uint8_t, std::uint8_t>> connect_pair_list;
    };


    template<std::uint16_t charset_size, std::uint8_t rotors_number>
    EnigmaKey<rotors_number> GenerateKey(const std::uint64_t seed, const std::uint16_t pair_number = (charset_size / 2))
    {
        EnigmaKey<rotors_number> key;

        key.connect_pair_list = generateRandomNoReflexiveMappingPairList<charset_size>(seed, pair_number);
        key.rotor_shifts = generateRandomArray<std::uint8_t, rotors_number>(0, charset_size - 1);

        return key;
    }
}